package project.newCode.materials;
import java.awt.Color;

import project.hulpPakket.Color3f;
import project.hulpPakket.TexCoord2f;
public class Material {

	private Color3f cs;
	private Color3f cr;
	private float phongExp;
	private float nin;
	private float nout;
	private Color3f crefr;
	
	// Constructor for diffuse materials
	public Material(Color3f cr) {
		super();
		this.cr = cr;
		this.cs = new Color3f(0,0,0);
		this.phongExp = 0F;
		this.nin = 0F;
		this.nout = 0F;
	}

	public Material(Color3f cs, Color3f cr, float phongExp, float nin,
			float nout) {
		super();
		this.cs = cs;
		this.cr = cr;
		this.phongExp = phongExp;
		this.nin = nin;
		this.nout = nout;
		this.crefr = new Color3f(0,0,0);
	}
	public Material(Color3f cs, Color3f cr, float phongExp, float nin,
			float nout, Color3f crefr) {
		super();
		this.cs = cs;
		this.cr = cr;
		this.phongExp = phongExp;
		this.nin = nin;
		this.nout = nout;
		this.crefr = crefr;
	}

	// Constructor for Phong materials
	public Material(Color3f cs, float phongExp) {
		super();
		this.cs = cs;
		this.cr = new Color3f(0,0,0);
		this.phongExp = phongExp;
	}
	
	// General constructor
	public Material(Color3f cs, Color3f cr, float phongExp) {
		super();
		this.cs = cs;
		this.cr = cr;
		this.phongExp = phongExp;
	}

	public Material() {
		this.cs = new Color3f(Color.black);
		this.cr = new Color3f(Color.white);
		this.phongExp = 0;
	}

	public Material linearCombination(Material m2, float f1, float f2) {
		Material m = new Material(Color3f.Plus(Color3f.Multiply(this.getCr(), f1),Color3f.Multiply(m2.getCr(), f2)));
		m.setCs(Color3f.Plus(Color3f.Multiply(this.getCs(), f1),Color3f.Multiply(m2.getCs(), f2)));
		m.setPhongExp(this.getPhongExp()*f1+m2.getPhongExp()*f2);
		return m;
	}

	
	public Color3f getCr(TexCoord2f tex) {
		return cr;
	}
	public Color3f getCs() {
		return cs;
	}
	public void setCs(Color3f cs) {
		this.cs = cs;
	}
	public Color3f getCr() {
		return cr;
	}
	public void setCr(Color3f cr) {
		this.cr = cr;
	}
	public float getPhongExp() {
		return phongExp;
	}
	public void setPhongExp(float phongExp) {
		this.phongExp = phongExp;
	}

	public float getNin() {
		return nin;
	}

	public void setNin(float nin) {
		this.nin = nin;
	}

	public float getNout() {
		return nout;
	}

	public void setNout(float nout) {
		this.nout = nout;
	}

	public Color3f getCrefr() {
		return crefr;
	}

	public void setCrefr(Color3f crefr) {
		this.crefr = crefr;
	}
	
	
}
